package controller;

import javafx.scene.control.TextArea;
import javafx.scene.image.Image;

public class Service {
//    分配筷子的方法（0不操作，1一次分配所有筷子，2最多允许4个同时拿左边筷子，3奇数拿左边，偶数拿右边）
    public static int method=0;
//    记录拿左边筷子的个数
    private int leftNum=0;
//    获取图片
    public static Image waitingImage = new Image("/img/waiting.png");
    public static Image thinkingImage = new Image("/img/thinking.png");
    public static Image eatingImage = new Image("/img/eating.png");
    public static Image initImage = new Image("/img/init.png");

    public Service(){}

    public synchronized boolean addLeftNum(){
        if(this.leftNum<4){
            this.leftNum++;
            return true;
        }else {
            return false;
        }
    }

    public synchronized void lessLeftNum(){
        this.leftNum--;
    }

    public int getLeftNum() {
        return leftNum;
    }
}
